/*
 * @Descripttion:
 * @Author: YuZhenJing
 * @Date: 2020-02-10 17:46:21
 * @LastEditors: YuZhenJing
 * @LastEditTime: 2020-05-13 18:33:28
 */
module.exports = {
  // 修改 src 为 examples
  pages: {
    index: {
      entry: 'examples/main.js',
      template: 'public/index.html',
      filename: 'index.html'
    }
  },
  devServer: {
    proxy: {
      '/example': {
        target: 'http://127.0.0.1:9892',
        changeOrigin: true,
        pathRewrite: {
          '^/example': '/example'
        }
      }
    }
  },
  // 强制内联CSS
  css: { extract: false },
  // 扩展 webpack 配置，使 packages 加入编译
  chainWebpack: config => {
    config.module
      .rule('js')
      .include.add(__dirname + 'packages')
      .end()
      .use('babel')
      .loader('babel-loader')
      .tap(options => {
        // 修改它的选项...
        return options
      })
  }
}
